//
//  NSTimer+Category.m
//  game
//
//  Created by 马凌云 on 2018/3/8.
//  Copyright © 2018年 YD. All rights reserved.
//

#import "NSTimer+Category.h"

@implementation NSTimer (Category)

+ (NSTimer *)ca_scheduledTimerWithTimeInterval:(NSTimeInterval)interval
                                       repeats:(BOOL)repeats
                                         block:(void(^)(void))block{
    return [self scheduledTimerWithTimeInterval:interval target:self selector:@selector(ca_blockInvoke:) userInfo:[block copy] repeats:repeats];
}

+ (void)ca_blockInvoke:(NSTimer *)timer{
    void (^block)(void) = timer.userInfo;
    if(block) {
        block();
    }
}



@end
